from .base_page import *

class LoginPage(BasePage):
    def __init__(self, webdriver):
        super().__init__(webdriver)

    # 定位器
    USERNAME = ('id', 'username')
    PASSWORD = ('id', 'password')
    LOGIN_BUTTON = ('id', 'login__submit')

    def open_login_page(self, bmc_ip):
        self.webdriver.get(f"https://{bmc_ip}")

    def enter_username(self, username):
        element = self.find_element(*self.USERNAME)
        self.input_text(element=element, text=username)

    def enter_password(self, password):
        element = self.find_element(*self.PASSWORD)
        self.input_text(element=element, text=password)

    def click_login(self):
        element = self.find_element(*self.LOGIN_BUTTON)
        self.click_element(element=element)

        